Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEA Callbacks base infrastructure + progress bars (Alternative to #27663) #28760

Open
wants to merge 70 commits into
base: callbacks
Choose a base branch
from

Conversation

jeremiedbb
Copy link
Member

Alternative to #27663 based on feedback from the drafting meeting. I'm keeping both open for now for easier comparison.

Copy link

github-actions bot commented Apr 3, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 7d41b31. Link to the linter CI: here

@jeremiedbb
Copy link
Member Author

@glemaitre and @adrinjalali I think this is ready for reviews. I implemented the changes discussed during some drafting meetings compared to #27663.

A quick summary.

From the point of view of a user:

  • callback objects are available from sklearn.callback. In this PR, only ProgressBar is implemented.
  • callbacks are registered to estimators using the set_callbacks(ProgressBar()).
  • if I want to enable the ProgressBar to all inner steps of my pipeline: ProgressBar(max_estimator_depth=None). Limited to depth=1 by default for performance considerations.

From the point of view of a third party developer of estimators:

  • Callback support is enabled through the CallbackSupportMixin
  • A CallbackContext object must be created at the beginning of fit (using init_callback_context from the mixin). This object is then used to create sub-contexts for subtasks, evaluate the callback hooks, and eventually propagate the callbacks to sub-estimators.

From the point of view of a third party developer of callbacks:

  • Callbacks must follow the CallbackProtocol protocol (3 hooks essentially).
  • Callbacks that should be propagated to inner estimators must follow an additional protocol.
  • The 3 hooks, receive different args. Their signature will be refined and better documented in follow-up PRs. One key arg is the node of the current task, which is a TaskNode object and is useful to find at which step the hook was called and take actions upon that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant